import { del, get, patch, post } from '../utils/http';
/* 医院列表*/

interface insertDataAPIParams {
  name: 'string';
  desc: 'string';
  image: 'string';
  content: 'string';
  address: 'string';
  phone: 'string';
}
/**
 * 新增数据
 * @param data
 * @returns
 */
export const insetrDataAPI = (data: insertDataAPIParams) =>
  post('/admin/hospitals', data);

/**
 * 根据id删除
 * @param id
 * @returns
 */
export const delByIdAPI = (id: any) => del('/admin/hospitals/' + id);

interface updateAPIParams {
  name: 'string';
  desc: 'string';
  image: 'string';
  content: 'string';
  address: 'string';
  phone: 'string';
}
/**
 * 修改
 * @param id
 * @param data
 * @returns
 */
export const updateByIdAPI = (id: any, data: updateAPIParams) =>
  patch('/admin/hospitals/' + id, data);

interface LoadDataAPIParams {
  page?: number;
  pageSize?: number;
  name?: string;
}
/**
 * 分页形式获取列表数据&&查
 * @param
 * @returns
 */
export const loadDataAPI = ({ page, pageSize, name }: LoadDataAPIParams) =>
  get('/admin/hospitals', {
    page, //页码
    per: pageSize, //每页显示的数量
    name,
  });
